

***********************
** Study 2: Figure S2.8
***********************


* 2017
import excel "TopHeadlineStories_2017_Top10.xlsx", sheet("Tabelle1") firstrow clear
gen statadate = date(Date, "DMY") 
format statadate %td
tab Theme
gen Brexit = (Theme == "Brexit")
gen CelebritiesScandals = (Theme == "Celebrities/scandals")
gen ClimatePolicy = (Theme == "Climate policy")
gen DeRadical = (Theme == "De-radicalization program")
gen ElectionPolls = (Theme == "Election polls")
gen ElectionOther = (Theme == "Election other")
gen Hillsborough = (Theme == "Hillsborough ruling")
gen HongKong = (Theme == "Hong Kong")
gen ImmigrationPolicy = (Theme == "Immigration policy") 
gen LabourAntiSemitism = (Theme == "Labour anti-semitism")
gen LondonBridgeAttack = (Theme == "London Bridge attack")
gen Manchester = (Theme == "Manchester bombing")
gen SocialPolicy = (Theme == "Social policy") 
gen TaxPolicy = (Theme == "Tax policy") 
gen Uber = (Theme == "Uber taxi license") 
tab Theme, sort
drop if Theme == "NoPaper"
collapse Brexit - Uber, by(statadate)
replace SocialPolicy = LondonBridgeAttack + SocialPolicy
replace CelebritiesScandals = SocialPolicy + CelebritiesScandal
replace ElectionPolls = CelebritiesScandals + ElectionPolls
replace ElectionOther = ElectionPolls + ElectionOther
replace Brexit =  ElectionOther + Brexit
replace TaxPolicy = Brexit + TaxPolicy
replace ImmigrationPolicy = TaxPolicy + ImmigrationPolicy
replace Manchester = ImmigrationPolicy + Manchester
replace DeRadical = Manchester + DeRadical
replace ClimatePolicy = DeRadical + ClimatePolicy
foreach var of varlist Brexit - Uber {
replace `var' = `var' * 100
}

	
twoway ///	
	(bar LabourAntiSemitism statadate, fcolor(cranberry) lcolor(black)) ///
	(bar Hillsborough statadate, fcolor(gs6) lcolor(black)) ///	
	(bar HongKong statadate, fcolor(brown) lcolor(black)) ///
	(bar Uber statadate, fcolor(teal) lcolor(black)) ///
	(bar ClimatePolicy statadate, fcolor(emerald) lcolor(black)) ///
	(bar DeRadical statadate, fcolor(gs12) lcolor(black)) ///
	(bar Manchester statadate, fcolor(purple) lcolor(black)) ///	
	(bar ImmigrationPolicy statadate, fcolor(orange_red) lcolor(black)) ///
	(bar TaxPolicy statadate, fcolor(orange) lcolor(black)) ///
	(bar Brexit statadate, fcolor(olive) lcolor(black)) ///
	(bar ElectionOther statadate, fcolor(lavender) lcolor(black)) ///
	(bar ElectionPolls statadate, fcolor(eltblue) lcolor(black)) ///
	(bar CelebritiesScandals statadate, fcolor(gold) lcolor(black)) ///
	(bar SocialPolicy statadate, fcolor(navy) lcolor(black)) ///
	(bar LondonBridgeAttack statadate, fcolor(black) lcolor(black)) ///
	, ///
	ytitle("Share of stories (%)") yscale(noextend nofextend) ylabel(, angle(horizontal) nogrid) ///
	xtitle("") xscale(noextend nofextend noline) xlabel(#7, angle(stdarrow) format(%tdMon_dd) notick labgap(medsmall)) ///
	title("2017", size(large) margin(0 0 12 1)) ///
	text(102 20971 "Pre-attack", place(n) orientation(horizontal) size(medsmall)) ///
	text(102 20973 "Day of" "attack", place(n) orientation(horizontal) size(medsmall)) ///
	text(102 20975 "Post-attack", place(n) orientation(horizontal) size(medsmall)) ///
	legend(span cols(3) position(6) symxsize(*0.5) colfirst order(15 "London Bridge attack" 10 "Brexit" 13 "Celebrities/scandals" 5 "Climate policy" 6 "De-radicalization program" 12 "Election polling" 11 "Election other" 2 "Hillsborough ruling" 3 "Hong Kong" 8 "Immigration policy" 7 "Manchester bombing" 1 "Labour anti-semitism" 14 "Social policy" 9 "Tax policy" 4 "Uber London license") region(lstyle(none) lcolor(white))) ///
	scheme(s2mono) xsize(4) ysize(6) graphregion(fcolor(white) lcolor(white)) plotregion(margin(2 2 0 0)) bgcolor(white)
*gr_edit .title.xoffset = -17.5	
graph save "2017.gph", replace


* 2019
import excel "TopHeadlineStories_2019_Top10.xlsx", sheet("Tabelle1") firstrow clear
gen statadate = date(Date, "DMY") 
format statadate %td
tab Theme
gen Brexit = (Theme == "Brexit")
gen CelebritiesScandals = (Theme == "Celebrities/scandals")
gen ClimatePolicy = (Theme == "Climate policy")
gen DeRadical = (Theme == "De-radicalization program")
gen ElectionPolls = (Theme == "Election polls")
gen ElectionOther = (Theme == "Election other")
gen Hillsborough = (Theme == "Hillsborough ruling")
gen HongKong = (Theme == "Hong Kong")
gen ImmigrationPolicy = (Theme == "Immigration policy") 
gen LabourAntiSemitism = (Theme == "Labour anti-semitism")
gen LondonBridgeAttack = (Theme == "London Bridge attack")
gen Manchester = (Theme == "Manchester bombing")
gen SocialPolicy = (Theme == "Social policy") 
gen TaxPolicy = (Theme == "Tax policy") 
gen Uber = (Theme == "Uber taxi license") 
tab Theme, sort
drop if Theme == "NoPaper"
collapse Brexit - Uber, by(statadate)
replace SocialPolicy = LondonBridgeAttack + SocialPolicy
replace LabourAntiSemitism = SocialPolicy + LabourAntiSemitism
replace CelebritiesScandals = LabourAntiSemitism + CelebritiesScandals
replace ElectionPolls = CelebritiesScandals + ElectionPolls
replace ElectionOther = ElectionPolls + ElectionOther
replace Hillsborough = ElectionOther + Hillsborough
replace TaxPolicy = Hillsborough + TaxPolicy
replace Brexit = TaxPolicy + Brexit
replace HongKong = Brexit + HongKong
replace Uber = HongKong + Uber
foreach var of varlist Brexit - Uber {
replace `var' = `var' * 100
}
	
twoway ///	
	(bar ClimatePolicy statadate, fcolor(emerald) lcolor(black)) ///
	(bar DeRadical statadate, fcolor(gs12) lcolor(black)) ///
	(bar ImmigrationPolicy statadate, fcolor(orange_red) lcolor(black)) ///
	(bar Manchester statadate, fcolor(purple) lcolor(black)) ///
	(bar Uber statadate, fcolor(teal) lcolor(black)) ///
	(bar HongKong statadate, fcolor(brown) lcolor(black)) ///
	(bar Brexit statadate, fcolor(olive) lcolor(black)) ///
	(bar TaxPolicy statadate, fcolor(orange) lcolor(black)) ///
	(bar Hillsborough statadate, fcolor(gs6) lcolor(black)) ///	
	(bar ElectionOther statadate, fcolor(lavender) lcolor(black)) ///
	(bar ElectionPolls statadate, fcolor(eltblue) lcolor(black)) ///
	(bar CelebritiesScandals statadate, fcolor(gold) lcolor(black)) ///
	(bar LabourAntiSemitism statadate, fcolor(cranberry) lcolor(black)) ///
	(bar SocialPolicy statadate, fcolor(navy) lcolor(black)) ///
	(bar LondonBridgeAttack statadate, fcolor(black) lcolor(black)) ///
	, ///
	ytitle("Share of stories (%)") yscale(noextend nofextend) ylabel(, angle(horizontal) nogrid) ///
	xtitle("") xscale(noextend nofextend noline) xlabel(#7, angle(stdarrow) format(%tdMon_dd) notick labgap(medsmall)) ///
	title("2019", size(large) margin(0 0 12 1)) ///
	text(102 21880 "Pre-attack", place(n) orientation(horizontal) size(medsmall)) ///
	text(102 21882 "Day of" "attack", place(n) orientation(horizontal) size(medsmall)) ///
	text(102 21884 "Post-attack", place(n) orientation(horizontal) size(medsmall)) ///
	legend(span cols(3) position(6) symxsize(*0.5) colfirst order(15 "London Bridge attack" 7 "Brexit" 12 "Celebrities/scandals" 1 "Climate policy" 2 "De-radicalization program"  11 "Election polling" 10 "Election other" 9 "Hillsborough ruling" 6 "Hong Kong" 3 "Immigration policy" 4 "Manchester bombing" 13 "Labour anti-semitism" 14 "Social policy" 8 "Tax policy" 5 "Uber London license") region(lstyle(none) lcolor(white))) ///
	scheme(s2mono) xsize(4) ysize(6) graphregion(fcolor(white) lcolor(white)) plotregion(margin(2 2 0 0)) bgcolor(white)
*gr_edit .title.xoffset = -17.5	
graph save "2019.gph", replace

* Graph combine
graph combine 2017.gph 2019.gph, ycommon iscale(*1) xsize(9) ysize(6) graphregion(fcolor(white) lcolor(white) lwidth(vthick)) plotregion(fcolor(white) lcolor(white))
gr_edit .plotregion1.graph1.legend.draw_view.setstyle, style(no)
gr_edit .plotregion1.graph1.legend.fill_if_undrawn.setstyle, style(yes)
gr_edit .plotregion1.graph2.legend.xoffset = -38
gr_edit .plotregion1.graph2.legend.plotregion1.label[1].xoffset = -12
gr_edit .plotregion1.graph2.legend.plotregion1.key[1].DragBy 0 -12
gr_edit .plotregion1.graph2.legend.plotregion1.label[2].xoffset = -12
gr_edit .plotregion1.graph2.legend.plotregion1.key[2].DragBy 0 -12
gr_edit .plotregion1.graph2.legend.plotregion1.label[3].xoffset = -12
gr_edit .plotregion1.graph2.legend.plotregion1.key[3].DragBy 0 -12
gr_edit .plotregion1.graph2.legend.plotregion1.label[4].xoffset = -12
gr_edit .plotregion1.graph2.legend.plotregion1.key[4].DragBy 0 -12
gr_edit .plotregion1.graph2.legend.plotregion1.label[5].xoffset = -12
gr_edit .plotregion1.graph2.legend.plotregion1.key[5].DragBy 0 -12
gr_edit .plotregion1.graph2.legend.plotregion1.label[11].xoffset = 12
gr_edit .plotregion1.graph2.legend.plotregion1.key[11].DragBy 0 12
gr_edit .plotregion1.graph2.legend.plotregion1.label[12].xoffset = 12
gr_edit .plotregion1.graph2.legend.plotregion1.key[12].DragBy 0 12
gr_edit .plotregion1.graph2.legend.plotregion1.label[13].xoffset = 12
gr_edit .plotregion1.graph2.legend.plotregion1.key[13].DragBy 0 12
gr_edit .plotregion1.graph2.legend.plotregion1.label[14].xoffset = 12
gr_edit .plotregion1.graph2.legend.plotregion1.key[14].DragBy 0 12
gr_edit .plotregion1.graph2.legend.plotregion1.label[15].xoffset = 12
gr_edit .plotregion1.graph2.legend.plotregion1.key[15].DragBy 0 12

* Erase individual graphs
erase "2017.gph"
erase "2019.gph"